<template>
	<view class="content">

		<view class="nav_box">	
			<MyNavbar :tabList="tabList" @tabClick="tabClick" :clickCurrentt="tabCurrent" ref="mymavbar"></MyNavbar>
		</view>
		
		<template v-if="tabCurrent == 0">
			<view class="search_box">
				<view class="search">
					<view class="icon"></view>
					<u--input
					    placeholder="搜索用户昵称和聊天内容"
					    border="none"
						fontSize="26rpx"
						color="#BBBBBB"
					    v-model="searchValue"
					></u--input>
				</view>
			</view>
			
			<view class="chat_list">
				<view class="chat_item" v-for="item in 6">
					<view class="avatar_box">
						<view class="avatar">
							<image src="http://www.jiubakeji.cn/images/nv1.jpeg" style="width: 100%; height: 100%;" mode=""></image>
						</view>
						
						<view class="icon"></view>
					</view>
			
					<view class="message_box">
						<text style="font-size: 30rpx; color: #333333; font-weight: bold;">elite295</text>
						<view class="down">
							<text>大床房还剩一张</text>
							<text>2022-02-22  19:41</text>
						</view>
					</view>
				</view>
				
			</view>
		</template>
		
		<template v-if="tabCurrent == 3">
			<text>系统消息</text>
		</template>
		
		
	</view>
</template>

<script>
	import MyNavbar from "@/components/my_navbar/my_navbar.vue"
	export default {
		data() {
			return {
				tabList: [
					{	
					    name: '聊天'
					}, 
					{
					    name: '民宿订单'
					}, 
					{
					    name: '商品订单'
					}, 
					{
					    name: '系统消息'
					}
				],
				searchValue: "",
				tabCurrent: 0,
			}
		},
		methods: {
			tabClick(e){
				
				if(e == 1) {
					uni.navigateTo({
						url: '/pages/order/order?type=1'
					})
				} else if(e == 2) {
					uni.navigateTo({
						url: '/pages/order/order?type=2'
					})
				} else {
					this.tabCurrent = e
				}
				
			}
		},
		components: {
			MyNavbar
		},
		onShow() {
			this.$refs.mymavbar.refMethod(this.tabCurrent)
		}
		
	}
</script>

<style lang="scss">
	.content {
		height: 100%;
		padding-top: 100rpx;
		background-color: #ffffff;
		.nav_box {
			position: fixed;
			top: 0;
			left: 0;
			width: 100%;
			padding: 0 55rpx;
			background-color: #fff;
			box-sizing: border-box;
			z-index: 99999;
		}
		
		.search_box {
			
			padding: 0 32rpx;
			.search {
				display: flex;
				align-items: center;
				padding: 24rpx;
				.icon {
					width: 33rpx;
					height: 33rpx;
					background: url(@/static/img/search.png) no-repeat;
					background-size: 33rpx;
					margin-right: 25rpx;
				}
			}
		}
	
		.chat_list {
			margin-top: 15rpx;
			padding: 30rpx;
			
			.chat_item {
				display: flex;
				align-items: center;
				padding: 30rpx;
				margin-bottom: 2rpx;
				.avatar_box {
					position: relative;
					.avatar {
						width: 88rpx;
						height: 88rpx;
						margin-right: 30rpx;
						border-radius: 50%;
						overflow: hidden;
					}
					.icon {
						position: absolute;
						right: 27rpx;
						bottom: 7rpx;
						width: 13rpx;
						height: 13rpx;
						background: #0BFF84;
						border: 3rpx solid #FFFFFF;
						border-radius: 50%;
					}
				}
				
				
				
				.message_box {
					display: flex;
					flex-direction: column;
					justify-content: space-between;
					flex: 1;
					padding: 9rpx 0;
					.down {
						display: flex;
						justify-content: space-between;
						font-size: 24rpx;
						font-weight: 500;
						color: #BBBBBB;
					}
					
				}
			}
			
			
			
			
		}
		
	
	}
	
</style>
